package org.zachary.commonservice.controller;


import lombok.extern.slf4j.Slf4j;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.zachary.commonmodule.entity.MqTransmissionJson;
import org.zachary.commonservice.entity.CreditScoreStrategy;
import org.zachary.commonservice.entity.OverdueRecord;
import org.zachary.commonservice.mapper.CreditScoreStrategyMapper;
import org.zachary.commonservice.mapper.StrategyMapper;
import org.zachary.commonservice.massage_queue.KafkaProducerService;
import org.zachary.commonservice.service.OverdueService;

import java.time.Instant;
import java.util.List;

@Slf4j
@RestController("/test")
@RequestMapping("/test")
public class TestMQController {
    private final KafkaProducerService kafkaProducerService;
    private final StrategyMapper strategyMapper;
    private final OverdueService overdueService;


    public TestMQController(KafkaProducerService kafkaProducerService, StrategyMapper strategyMapper, OverdueService overdueService) {
        this.kafkaProducerService = kafkaProducerService;
        this.strategyMapper = strategyMapper;
        this.overdueService = overdueService;
    }

    @GetMapping("/send")
    public void testKafka(){

        System.out.println("hotelBooking");

    }
    @GetMapping("/json")
    public void testJson(){
        MqTransmissionJson json=new MqTransmissionJson(
                "rerth45s",
                1,
                1,
                true,
                2,
                false,
                89.0,
                "服务测试",
                Instant.now(),
                Instant.now()
        );
        kafkaProducerService.sendJsonMessage("TestTopic",json);
    }
    @GetMapping("/overdue")
    public void testOverdue(){
        MqTransmissionJson record=new MqTransmissionJson(
                "845378y4773c84c",
                101,
                2,
                true,
                -1,
                true,
                0.00,
                "描述",
                Instant.now(),
                null
        );
        kafkaProducerService.sendJsonMessage("TestTopic",record);
    }
    @GetMapping("/finished")
    public void testOverdueFinished(){
        MqTransmissionJson record=new MqTransmissionJson(
                "845378y4773c84c",
                101,
                2,
                true,
                1,
                true,
                78.9,
                "测试消息",
                Instant.now(),
                Instant.now()
        );
        kafkaProducerService.sendJsonMessage("TestTopic",record);
    }

}
